import $config  from '../config/config';
export default  (...arrays) => {
  return new Promise(
      (resolve, reject) => {
          $.ajax({
              type: arrays[2].toUpperCase() || 'POST',
              url: $config.serverURL + arrays[0],
              data: arrays[1] || {},
              dataType: 'json',
              contentType:arrays[3]||'application/x-www-form-urlencoded',
              header: arrays[3]||{
                  'content-type': 'application/x-www-form-urlencoded'
              },
              success: res => {
                  resolve(res)
              },
              error: err => {
                  reject(err)
              }
          });
      }
  )
}
